﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using YDAT.YdatDB;

public partial class AddContactInfo : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void UpdateContactInfo()
    {
        YDATDataContext ydat = new YDATDataContext();
        
        ContactInfo contactInfo = (from c in ydat.ContactInfos
                                   where c.contactInfoId == Int32.Parse(hfContactInfoId.Value)
                               select c).First();
        
        contactInfo.address1 = tbAddress1.Text;
        contactInfo.address2 = tbAddress2.Text;
        contactInfo.city = tbCity.Text;
        contactInfo.state = ddlState.SelectedValue;
        contactInfo.zip = tbZip.Text;
        contactInfo.country = ddlCountry.SelectedValue;
        contactInfo.zip = tbZip.Text;
        contactInfo.email = tbEmail.Text;
        contactInfo.website = tbWebsite.Text;
        contactInfo.notes = tbNotes.Text;

        ydat.SubmitChanges();
    }
}
